/**
 * 
 */
package pt.mleiria.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import pt.mleiria.bo.TextLoaderBO;

/**
 * @author root
 *
 */
public class GastronomyController implements Controller {
	private TextLoaderBO textLoaderBO;
	

	/**
	 * @return the textLoaderBO
	 */
	public TextLoaderBO getTextLoaderBO() {
		return textLoaderBO;
	}

	/**
	 * @param textLoaderBO the textLoaderBO to set
	 */
	public void setTextLoaderBO(TextLoaderBO textLoaderBO) {
		this.textLoaderBO = textLoaderBO;
	}

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse arg1) throws Exception {
		final String lang = (String)request.getSession().getAttribute("lang"); 
		request.getSession().setAttribute("gastronomy", textLoaderBO.loadGastronomy(lang).toString());
		return new ModelAndView("gastronomy");
	}

}
